package com.king.util;

import com.king.entity.User;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @author jinguoguang
 * @version 1.0
 * @data 2024/2/27 16:30
 */
public class UserGeneratorUtil {

    private static final String[] NAMES = {"Alice", "Bob", "Charlie", "David", "Eve", "Frank", "Grace", "Henry", "Ivy", "John"};
    private static final String[] GENDERS = {"Male", "Female"};
    private static final String[] DEPARTMENTS = {"人事部", "研发部", "金融部", "销售部"};

    public static List generateUsers(int numUsers) {
        List users = new ArrayList<>();
        Random random = new Random();

        for (int i = 0; i < numUsers; i++) {
            User user = new User();
            user.setId(i + 1);
            user.setName(NAMES[random.nextInt(NAMES.length)]);
            user.setGender(GENDERS[random.nextInt(GENDERS.length)]);
            user.setAge(random.nextInt(61) + 20); // Generate age between 20 and 80
            user.setDepartment(DEPARTMENTS[random.nextInt(DEPARTMENTS.length)]);
            user.setSalary(BigDecimal.valueOf(random.nextInt(10000) + 5000)); // Generate salary between 5000 and 15000
            users.add(user);
        }
        return users;
    }
}
